/*******************************************************************************
 * Venice Noise Android Application
 * Copyright (C) 2011  Worcester Polytechnic Institute, Wesley Ripley
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * If you plan to use or modify any of this code please contact Fabio Carrera (carrera.fabio@gmail.com)
 * Also please attribute any code used in the final product to the developers. 
 * 
 * Author: Wesley Ripley (wripley@wpi.edu) 
 *******************************************************************************/
package org.venicenoise.app;

import android.content.SharedPreferences;

/**
 * Interface for classes that can save their state in SharedPreferences
 * @author Wesley Ripley
 * @version 12/15/2011
 */
public interface StateSaveable {

	/**
	 * Saves current state of the object in the shared preferences
	 * 
	 * @param prefsEditor
	 * 		The preference editor to use to store the state
	 * @return
	 * 		The same editor given with the state saved in it. 
	 * 		Allows for this call to be chained with other edits to preferences
	 */
	public SharedPreferences.Editor saveSate(SharedPreferences.Editor prefsEditor);
	
	/**
	 * Load the state back from shared preferences. 
	 * State must be stored using saveState for this to succeed.
	 * @param prefs
	 * 		Shared preferences where state is stored.
	 * @return
	 * 		true is the loading was successful, false otherwise
	 */
	public boolean loadState(SharedPreferences prefs);
	
}
